package thread.pipe_stream;

import java.io.IOException;
import java.io.PipedInputStream;

/**
 * Created by mHandler on 2018/6/2 0002.
 * Description:
 */
public class ReadData {
    public void readMethod(PipedInputStream input){
        try {
            System.out.println("read : ");
            byte[] bytes = new byte[20];
            int len = input.read(bytes);
            while (len != -1){
                String newData = new String(bytes, 0 , len);
                System.out.print(newData);
                len = input.read(bytes);
            }
            System.out.println();
            input.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
